include(CheckLanguage)
check_language(CUDA)
if(CMAKE_CUDA_COMPILER)
    enable_language(CUDA)
    find_package(CUDAToolkit REQUIRED)

    function(build_file file_name)
        get_filename_component(target ${file_name} NAME_WE)
        add_executable(${target} ${file_name})
        target_link_libraries(${target} PRIVATE CUDA::cudart)
        set_property(TARGET ${target} PROPERTY CUDA_ARCHITECTURES 50 60 70 75 80 86)
    endfunction()

    if(CUDAToolkit_FOUND)
        build_file(cuda_check.cpp)
    endif()

endif()

